package common.store.web.service.impl;

import common.store.web.bean.Cart;
import common.store.web.bean.CartAndProduct;
import common.store.web.bean.Order;
import common.store.web.bean.orderAndProduct;
import common.store.web.dao.CartDao;
import common.store.web.dao.OrderDao;
import common.store.web.service.OrderService;
import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Map;

public class OrderServiceImpl implements OrderService {
    static OrderDao orderDao;

    static {
        orderDao = new OrderDao();
    }

    /**
     * 提交购物车进入订单，若已存在则更新，否则增加条目
     * @return
     */
    @Override
    public Integer addOrder(String uid) {

        return OrderDao.addOrder(uid);
    }

    @Override
    public List<orderAndProduct> getOrderList(String uid) {
        return orderDao.getOrderList(uid);
    }

    @Override
    public void deleteOrderById(String uid) {
        orderDao.deleteALLOrderById(uid);
    }

    @Override
    public Integer updateOrder(Order order) {
        return orderDao.update(order);
    }


}
